
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class PVReducer extends Reducer<Text, LongWritable, Text, LongWritable> {
    private Map<String, Integer> count = new HashMap<String, Integer>();
    private LongWritable outputValue = new LongWritable();

    @Override
    protected void reduce(Text key, Iterable<LongWritable> values, Context context)
            throws IOException, InterruptedException {
        long sum = 0;
        for (LongWritable value : values) sum += value.get();
        outputValue.set(sum);
        // String date = data.split("\t")[0];
        // String uri = data.split("\t")[1];

        context.write(key, outputValue);
    }
}
